pub mod convert;
pub mod extractor;
pub mod handler;
pub mod log;
pub mod server;
pub mod util;

#[macro_export]
macro_rules! define_handler_straw {
    ($state: ty) => {
        pub struct MethodHandlerStrawImpl {
            pub handler_fn: carpet::server::handler::GetPathHandlerFn<$state>,
        }

        impl carpet::server::handler::MethodHandlerStraw for MethodHandlerStrawImpl {
            type S = $state;

            fn path_hander_fn(&self) -> carpet::server::handler::GetPathHandlerFn<Self::S> {
                self.handler_fn.clone()
            }
        }

        impl MethodHandlerStrawImpl {
            pub const fn new(
                handler_fn: carpet::server::handler::GetPathHandlerFn<$state>,
            ) -> Self {
                Self { handler_fn }
            }
        }

        inventory::collect!(MethodHandlerStrawImpl);
    };
}
